package com.example.java250806_spring_ioc_demo.controller;

import com.example.java250806_spring_ioc_demo.config.DbTypeConfig;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RequestMapping("/prop")
@RestController
public class PropertiesController {
    @Value("${spring.datasource.url}")
    private String url;

    @Value("${my.key1}")
    private Integer key1;

    @Value("${my.key2}")
    private Boolean key2;



    @RequestMapping("read")
    public String readProperties(){
        System.out.println(key1);
        System.out.println(key2);
        log.info("使用@slf4j打印日志");
        return "从配置文件中，读取url"+url;
    }
}



































